<template>
  <div class="hotbox" ref="box">
    <div class="content">
      <div class="mov-con">
        <ul class="mov-von-box">
          <li class="mov-li" v-for="(ele,index) in arr" :key="ele.mId">
            <div class="mov-img">
              <img :src="ele.small" class="img1" @click="go(ele.mId)" />
              <img src="@/assets/images/movie/play.png" class="mov-paly" />
            </div>
            <div class="con-p">
              <p class="conpone">{{ele.title}}</p>
              <p class="conptwo">
                影火虫评分
                <span class="conspan">{{ele.rating_average}}</span>
              </p>
              <p class="conthree">导演 ： {{ele.director[0]}}</p>
              <p class="conthree">主演 : {{ele.scriptwriter[0]}}</p>
              <div class="hot-icon" v-if="index==0?true:false">
                <van-tag type="success" plain color="#BA9546" class="tag1">今日最热</van-tag>
                <van-tag type="success" plain color="#A05462" class="tag2">一周最热</van-tag>
              </div>
            </div>
            <div class="btn">购票</div>
          </li>
        </ul>
      </div>
    </div>
  </div>
</template>

<script>
import BScroll from "@better-scroll/core";
let wrapper = document.querySelector(".wrapper");
export default {
  data() {
    return {
      arr: []
    };
  },
  computed: {},
  created() {
    this.$axios.get("/api/douban/movie/in_theaters").then(res => {
      this.arr = res.data.list;
      console.log(this.arr);
      this.refresh();
    });
  },
  mounted() {
    // this.$nextTick(() => {
    let wrapper = this.$refs.box;
    this.bScroll = new BScroll(wrapper, {
      click: true
    });
    // });
  },
  methods: {
    //跳转
    go(val) {
      // this.$router.push("/movie/point");
      this.$router.push({
        name: "point",
        params: { id: val }
      });
      // this.$store.commit("mid", val);
    },
    refresh() {
      this.$nextTick(() => {
        this.bScroll.refresh();
      });
    }
  }
};
</script>

<style scoped lang="scss">
.hot-icon {
  margin-top: 7px;
}
.tag1 {
  background: #33363d;
  margin-right: 6px;
}
.tag2 {
  background: #33363d;
}

.hotbox {
  width: 100%;
  background: rgba(35, 38, 45, 1);
  overflow: hidden;

  position: absolute;
  left: 0;
  top: 0;
  // overflow: hidden;
  // height: 500px
  height: 99vh;
}
.mov-con {
  width: 335px;
  margin: 0 auto;
  overflow: hidden;
  height: 1820px;
  margin-bottom: 40px;

  // background-color: red;
  li:nth-child(1) {
    margin-top: 69px;
  }

  .mov-li {
    width: 335px;
    height: 146px;
    background: rgba(51, 54, 61, 1);
    box-shadow: 0px 0px 4px 2px rgba(0, 0, 0, 0.04);
    border-radius: 6px;
    display: flex;
    margin-bottom: 25px;
    position: relative;

    .mov-img {
      width: 119px;
      height: 156px;
      transform: translateY(-10px);
      border-radius: 6px;
      position: relative;
      .img1 {
        height: 100%;
        width: 100%;
        border-radius: 6px;
      }

      .mov-paly {
        position: absolute;

        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
      }
    }
  }
}
.con-p {
  margin-left: 10px;
  margin-top: 15px;
}
.conpone {
  font-size: 16px;
  font-weight: 500;
  color: rgba(255, 255, 255, 1);
  line-height: 16px;
  text-align: left;
}
.conptwo {
  font-size: 14px;
  color: rgba(255, 255, 255, 1);
  line-height: 14px;
  text-align: left;
  margin-top: 15px;
}
.conspan {
  font-size: 14px;
  color: #fbc34a;
  line-height: 14px;
}
.conthree {
  width: 127px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 12px;
  font-family: PingFangSC-Regular, PingFang SC;
  font-weight: 400;
  color: rgba(255, 255, 255, 1);
  line-height: 12px;
  text-align: left;
  margin-top: 15px;
}
.btn {
  width: 54px;
  height: 25px;
  background: linear-gradient(
    150deg,
    rgba(242, 91, 134, 1) 0%,
    rgba(241, 172, 94, 1) 100%
  );
  box-shadow: 0px 0px 4px 1px rgba(242, 109, 125, 0.18);
  border-radius: 6px;
  line-height: 25px;
  color: rgba(255, 255, 255, 1);
  font-size: 12px;
  position: absolute;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
}
</style>
